<?php
    $totalInsert=$this->Session->read("totalInsert");
    $totalUpdate=$this->Session->read("totalUpdate");
    $totalIgnore=$this->Session->read("totalIgnore");

if($this->Session->read("login")=="yes")
{
    ?>
    <h2 align=center>File Upload Successful</h2>
    <p>Total Record Updated:<?php echo $totalUpdate?></p>
    <p>Total New Record Inserted:<?php echo $totalInsert ?></p>
    <p>Total Record Ignored:<?php echo $totalIgnore ?></p>
    <br>

    <?php
    if ($totalInsert>0)
    {
        ?>
        <div  name="update" style="white-space:pre; overflow:auto; width:100% ; height:50%;padding:10px;">
            <p>The following records are New records</p>
            <table cellpadding="0" cellspacing="0">
                <th>
                    <tr>
                        <td>Name</td>
                        <td>Date</td>
                        <td>Value</td>
                    </tr>
                </th>
                <tb>
                    <?php
                    for($n=1;$n<=$totalInsert;$n++)
                    {
                        echo "<tr>";
                        echo "<td>".$this->Session->read("insertName[".$n."]")."</td>";
                        echo "<td>".$this->Session->read("insertDate[".$n."]")."</td>";
                        echo "<td>".$this->Session->read("insertValue[".$n."]")."</td>";
                        echo "<tr>";
                    }
                    ?>
                </tb>
            </table>
        </div>
        <br><br>
    <?php
    }
    if ($totalUpdate>0)
    {
        ?>
        <p>The following records are Updated records</p>
        <div  name="insert" style="white-space:pre; overflow:auto; width:100% ; height:50%;padding:10px;">
            <table cellpadding="0" cellspacing="0">
                <th>
                    <tr>
                        <td>Name</td>
                        <td>Date</td>
                        <td>Value</td>
                    </tr>
                </th>

                <tb>
                    <?php
                    for($n=1;$n<=$totalUpdate;$n++)
                    {
                        echo "<tr>";
                        echo "<td>".$this->Session->read("updateName[".$n."]")."</td>";
                        echo "<td>".$this->Session->read("updateDate[".$n."]")."</td>";
                        echo "<td>".$this->Session->read("updateValue[".$n."]")."</td>";
                        echo "<tr>";
                    }
                    ?>
                </tb>
            </table>
        </div>
    <?php
    }
    ?>
    <div align=center>
    <?php
        echo $this->Form->create($model=false);
        echo $this->Form->submit('Calculation', array('div'=>false,
            'name'=>'calculation' ));?>&nbsp;
    </div>
    <p>Calculations may take some time, please do not close your browser until you are redirected to the calculation complete page</p>
    <?php
}
else
{
    echo "<p> You can't view the content of this page. </p>";
}

    ?>
